package com.victor.system.api;

import com.victor.common.core.constant.SecurityConstants;
import com.victor.common.core.constant.ServiceNameConstants;
import com.victor.common.core.domain.R;
import com.victor.common.entity.system.SysDictionary;
import com.victor.system.api.factory.RemoteDictionaryFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户服务
 */
@FeignClient(contextId = "remoteDictionaryService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteDictionaryFallbackFactory.class)
public interface RemoteDictionaryService {
    /**
     * 通过用户名查询用户信息
     *
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/sysDictionary/listByFieldName")
    public R<List<SysDictionary>> listByFieldName(@RequestParam("fieldName") String fieldName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 通过用户名查询用户信息
     *
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/sysDictionary/getByFieldNameAndCode")
    public R<SysDictionary> getByFieldNameAndCode(@RequestParam("fieldName") String fieldName, @RequestParam("code") String code, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
